<template>
  <el-form ref="form" :model="user_form" label-width="80px">
    <el-form-item label="用户名">
      <el-input disabled v-model="user_form.username"></el-input>
    </el-form-item>
    <el-form-item label="昵称">
      <el-input disabled v-model="user_form.nickname"></el-input>
    </el-form-item>
    <el-form-item label="老密码">
      <el-input type="password" v-model="user_form.password"></el-input>
    </el-form-item>

    <el-form-item label="新密码">
      <el-input type="password" v-model="user_form.new_password"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="setPasswordUserSubmit">确 定</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: "SetPassword",
  props: ["user_name", "user_id", "nickname"],
  watch: {
    user_name(val) {
      this.user_form.username = val;
    },
    user_id(val) {
      this.user_form.user_id = val;
    },
    nickname(val) {
      this.user_form.nickname = val;
    }
  },
  data() {
    return {
      user_form: {
        user_id: this.user_id,
        username: this.user_name,
        password: '',
        nickname: this.nickname,
        new_password: '',
      }
    }
  },
  methods: {
    empty_user_form() {
      this.user_form = {
        username: '',
        password: '',
        nickname: '',
      }
    },
    setPasswordUserSubmit(){
      this.$emit("UserSubmit",this.user_form)
    }
  }
}
</script>

<style scoped>

</style>